<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');  
class CI_Authenticate
{ 
	private $CI;
	private $admin_pages = array('borrower','category','home','locations','member','publication','quantity','report','users','profile'); 
	function CI_Authenticate()
	{ 
		$this->CI =& get_instance();
		$this->check_admin_login();
		//$this->check_client_login();
	} 
	
	function check_admin_login()
	{
		$page = $this->CI->uri->segment(1);
		
		if(in_array($page, $this->admin_pages))
		{
			if (!$this->CI->session->userdata('pub_admin_login_id')) 
			{ 
				if($this->CI->uri->segment(1))
					$this->CI->session->set_userdata('admin_redirect_login_url', uri_string()); 
					
				redirect(site_url('login'));  
			}
		}
	}
} 
?>